<template>
    <div id="app">
        <div class="banner">
            <div class="sidebar">
                <ul class="menu"> 
                    <li @mouseout='leave(index)' @mouseover='enter(index)' v-for="item,index in MainList">
                        <a href="javascript:;">{{item.name}}</a>
                        <a href="javascript:;">{{item.children[0].name}}</a>
                        <a href="javascript:;" v-if="item.children[1]">{{item.children[1].name}}</a>
                        <!-- <a href="javascript:;" v-for="A in item.children">{{A.name}}</a> -->
                    </li>
                    <li @mouseout='out' @mouseover='over'>
                        <a href="#">品牌</a>
                        <a href="#">品牌推荐</a>
                    </li>
                </ul>
                
            </div>
            <div class="content" v-show="isShow">
                    <h4>分类推荐<span>根据您的购买或者浏览记录推荐</span></h4>
                        <div class="list">
                            <dl v-for="(A,index) in arra[0]">
                                <dt><img :src="A.picture"></dt>
                                <dd>
                                    <p>{{A.name}}</p>
                                    <p>{{A.desc}}</p>
                                    <p>￥<span>{{A.price}}</span></p>
                                </dd>
                            </dl>
                        </div>
                </div>
            <div class="content" v-show="isShowP">
                    <h4>分类推荐<span>根据您的购买或者浏览记录推荐</span></h4>
                        <div class="listt">
                            <dl v-for="(A,index) in brandList">
                                <dt><img :src="A.picture"></dt>
                                <dd>
                                    <p>{{A.place}}</p>
                                    <p>{{A.name}}</p>
                                    <p>{{A.desc}}</p>
                                </dd>
                            </dl>
                        </div>
                </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'VueProject01Content',
    props:['MainList','brandList'],
    data() {
        return {
            arra:[],
            isShow:false,
            isShowP:false,
        };
    },

    mounted() {
    },

    methods: {
        out(index){
            this.isShowP=false

        },
        over(index){
            this.isShowP=true
        },
        leave(){
            this.isShow=false
            this.arra=[]
        },
        enter(index){
            this.MainList.some((item,i,arr)=>{
                if(index==i){
                    this.arra.push(arr[i].goods)
                }
            })
            this.isShow=true
            
        }
    },
};
</script>

<style scoped lang="scss">
    #app{
        width: 100%;
        height: 500px;
        background: rgb(245, 245, 245);
        // opacity: 0;
    }
    .banner{
        width: 1240px;
        height: 500px;
        margin: 0 auto;
        // background: url('http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-15/dfc11bb0-4af5-4e9b-9458-99f615cc685a.jpg');
        position: relative;
        .sidebar{
            width: 250px;
            height: 500px;
            background: rgba(0,0,0);
            opacity: .8 !important;
            position: relative;
            z-index: 99;
            position: absolute;
            left: 0;
            top: 0;
            width: 250px;
            height: 500px;
            .menu{
                li{
                    overflow: hidden;text-overflow:ellipsis;white-space: nowrap;
                    list-style: none;
                    padding-left: 40px;
                    height: 50px;
                    line-height: 50px;
                    display: flex;
                    justify-content: flex-start;
                    padding-right: 40px;
                    box-sizing: border-box;
                    &:hover{
                        background: #17ba9b;
                    }
                    a{
                        
                        text-decoration: none;
                        color: #FFF;
                        font-size: 14px;
                        margin-left: 4px;
                        &:nth-of-type(1){
                            font-size: 16px !important;
                        }
                    }
                }
            }
            
        }   
        .content{
                position: absolute;
                right: 0;
                top: 0;
                width: 990px;
                height: 500px;
                // background: #FFF;
                // opacity: .8;
                z-index: 99;
                background: rgba(255, 255, 255, 0.8);
                h4 {
                    font-size: 20px;
                    font-weight: 400;
                    line-height: 80px;
                    text-align: left;
                    padding-left: 15px;
                    box-sizing: border-box;
                    span {
                        font-size: 16px;
                        color: #666;
                        margin-left: 10px;
                    }
                }
                .list {
                    display: flex;
                    flex-wrap: wrap;
                    dl {
                        opacity: 10;
                        width: 290px;
                        height: 100px;
                        margin-right: 15px;
                        margin-bottom: 15px;
                        border: 1px solid #eee;
                        border-radius: 4px;
                        background: #fff;
                        display: flex;
                        padding: 10px;
                        dt {
                            width: 95px;
                            height: 95px;
                            margin-right: 10px;
                            img {
                                width: 100%;
                            }
                        }
                        dd {
                            display: flex;
                            flex-direction: column;
                            justify-content: space-between;
                            p {
                                line-height: 1.5em;
                                text-align: left;
                                &:nth-of-type(1) {
                                    font-size: 16px !important;
                                    color: #666;
                                    display: -webkit-box;
                                    -webkit-box-orient: vertical;
                                    -webkit-line-clamp: 2;
                                    width: 180px;
                                }
                                &:nth-of-type(2) {
                                    color: #999;
                                    white-space: nowrap;
                                    text-overflow: ellipsis;
                                    padding-top: 5px;
                                    padding-bottom: 5px;
                                    overflow: hidden;
                                    width: 180px;
                                }
                                &:nth-of-type(3) {
                                    font-size: 16px !important;
                                    color: #cf4444;
                                    span {
                                        font-size: 22px;
                                    }
                                }
                            }
                        }
                    }
                }
                .listt {
                    display: flex;
                    flex-wrap: wrap;
                    dl {
                        opacity: 10;
                        width: 290px;
                        height: 164px;
                        margin-right: 15px;
                        margin-bottom: 15px;
                        border: 1px solid #eee;
                        border-radius: 4px;
                        background: #fff;
                        display: flex;
                        padding: 10px;
                        dt {
                            width: 128px ;
                            height: 100%;
                            margin-right: 10px;
                            img {
                                width: 100%;
                                height: 100%;
                            }
                        }
                        dd {
                            display: flex;
                            flex-direction: column;
                            justify-content: start;
                            p {
                                line-height: 1.5em;
                                margin-bottom: 5px;
                                text-align: left;
                                &:nth-of-type(1) {
                                    font-size: 14px !important;
                                    color: #666;
                                    display: -webkit-box;
                                    -webkit-box-orient: vertical;
                                    -webkit-line-clamp: 2;
                                    // width: 180px;
                                }
                                &:nth-of-type(2) {
                                    font-size: 16px;
                                    color: #000;
                                    white-space: nowrap;
                                    text-overflow: ellipsis;
                                    padding-top: 5px;
                                    padding-bottom: 5px;
                                    overflow: hidden;
                                    // width: 180px;
                                }
                                &:nth-of-type(3) {
                                    font-size: 14px !important;
                                    color: #999;
                                }
                            }
                        }
                    }
                }
        }
            
    }
</style>